import request from "@/api/index.js"
// 获取二手分类标题
export function getUsedClassifyApi() {
  return request({
    url: "/IntactGoods/family",
    method: "get"
  })
}
// 获取商品列表
export function getSearchIntactGoodsApi(pagenum, familyId = 0, sort = 0, content = '') {
  let query = `?page=${pagenum}&sort=${sort}`;
  if (content) {
    query = query + `&content=${content}`
  }
  if (familyId) {
    query = query + `&familyId=${familyId}`
  }
  return request({
    url: `/IntactGoods/list${query}`,
    method: "get"
  })
}

// 搜索二手最新
export function getSearchGoodsNewestApi(pagenum, family = 0, name = '') {
  console.log(arguments);
  return request({
    url: `/IntactGoods/searchAll?content=${name}&page=${pagenum}&sort=0&familyId=${family}`,
    method: "get"
  })
}
//搜索二手最热
export function getSearchGoodsHottestApi(pagenum, family = 0, name = '') {
  return request({
    url: `/IntactGoods/searchAll?content=${name}&page=${pagenum}&sort=1&familyId=${family}`,
    method: "get"
  })
}
//搜索二手价格升序
export function getSearchGoodsPriceSortApi(pagenum, family = 0, name = '') {
  return request({
    url: `/IntactGoods/searchAll?content=${name}&page=${pagenum}&sort=2&familyId=${family}`,
    method: "get"
  })
}
export function getSearchGoodsPriceDropApi(pagenum, family = 0, name = '') {
  return request({
    url: `/IntactGoods/searchAll?content=${name}&page=${pagenum}&sort=3&familyId=${family}`,
    method: "get"
  })
}
export function carouselFigureApi(pagenum) {
  return request({
    url: `/carousel-figure`,
    method: "get"
  })
}
export function carouselFigureDetailApi(id) {
  return request({
    url: `/carousel-figure/${id}`,
    method: "get"
  })
}